package com.loyom.navi.common;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.loyom.navi.base.BaseObject;

public class ValidateUtils extends BaseObject {

    private static final long serialVersionUID = 1L;

    public static final int ZERO = 0;

    public static boolean isZero(Integer integer) {

        if (integer != null && integer == ZERO)
            return true;
        return false;
    }

    public static boolean isZero(Long lon) {

        if (lon != null && lon == ZERO)
            return true;
        return false;
    }

    public static boolean isZero(Double dou) {

        if (dou != null && dou == ZERO)
            return true;
        return false;
    }

    public static boolean isNull(Integer integer) {

        if (integer == null)
            return true;
        return false;
    }

    public static boolean isNull(Long lon) {

        if (lon == null)
            return true;
        return false;
    }

    public static boolean isNull(Double dou) {

        if (dou == null)
            return true;
        return false;
    }

    public static boolean isNullOrZero(Integer integer) {

        return isNull(integer) || isZero(integer);
    }

    public static boolean isNullOrZero(Long lon) {

        return isNull(lon) || isZero(lon);
    }

    public static boolean isNullOrZero(Double dou) {

        return isNull(dou) || isZero(dou);
    }

    public static boolean isEmpty(String str) {

        if (str == null || str.isEmpty())
            return true;
        return false;
    }

    public static <T> boolean isEmpty(List<T> list) {

        if (list == null || list.isEmpty())
            return true;
        return false;
    }

    public static <T> boolean isEmpty(Set<T> set) {

        if (set == null || set.isEmpty())
            return true;
        return false;
    }

    public static <T> boolean isEmpty(Collection<T> collection) {

        if (collection == null || collection.isEmpty())
            return true;
        return false;
    }

    public static <T, V> boolean isEmpty(Map<T, V> map) {

        if (map == null || map.isEmpty())
            return true;
        return false;
    }
}
